<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>

    <script>
        one = prompt("1.加法运算:\n2.减法运算:\n3.乘法运算:\n4.除法运算:\n5.退出:\n请输入您的选项：");
        a = prompt("请输入第一个数据")
        b = prompt("请输入第二个数据")
        if (one == '1') {
            alert(add(a, b));
        } else if (one == '2') {
            alert(sub(a, b));
        } else if (one == '3') {
            alert(cheng(a, b));
        } else {
            alert(chu(a, b));
        }

        function add(a, b) {
            return Number(a) + Number(b);
        }

        function sub(a, b) {
            return Number(a) - Number(b);
        }

        function cheng(a, b) {
            return Number(a) * Number(b);
        }

        function chu(a, b) {
            return Number(a) / Number(b);
        }
    </script>
</body>

</html>